from datetime import datetime
from enum import Enum

from flask import Flask, Blueprint, request
from flask_jwt_extended import jwt_required, get_jwt_identity
from myapp.utils.RedPrint import RedPrint
app = Flask(__name__)

api = RedPrint('users')


@jwt_required()
@api.route("/login", methods=['POST'])
def login():
    from myapp.service.UserService import loginManage
    login_info = request.form
    login_id = login_info.get("username")
    login_password = login_info.get("password")
    return loginManage(login_id, login_password)


@jwt_required()
@api.route("/signupByEmail", methods=['POST'])
def register_by_email():
    from myapp.service.UserService import RegisterByEmail
    register_info = request.form
    return RegisterByEmail(register_info)

@api.route("/signupByPhoneNum", methods=['POST'])
def register_by_phoneNum():
    from myapp.service.UserService import RegisterByPhoneNum
    register_info = request.form
    return RegisterByPhoneNum(register_info)
@api.route("/editInformation", methods=['POST'])
def editInformation():
    from myapp.service.UserService import EditUserInformation
    register_info = request.form
    return EditUserInformation(register_info)
@api.route("/getInformation", methods=['POST'])
def getUserInformation():
    from myapp.service.UserService import GetUserInformation
    user_info = request.form
    return GetUserInformation(user_info)